﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using InnovaApp.Layers.DataLayer;
using InnovaApp.Layers.ResourcesLayer.Properties;
using InnovaApp.Portals.MVC4Portal.Models;
using INNOVACALL.Framework.Common.MVCHelpers;
using INNOVACALL.Framework.Common;
using INNOVACALL.Framework.Common.Models;
using INNOVACALL.Framework.Common.CodeFormatting;

namespace InnovaApp.Portals.MVC4Portal.Controllers
{
	public class HomeController : _Controllers_Base<HomeModel>
	{
		protected override void Initialize(System.Web.Routing.RequestContext requestContext)
		{
			base.eMethodBase = "InnovaApp.Portals.InnovaAppFrontOfficePortal.Controllers.HomeController";
			base.specificCssCollection = new string[] { "_FormCommon.css", "Views/Home.css", "ClientComponents/CodeFormatting/csharp.css", "ClientComponents/KendoUI/kendo.common.min.css", "ClientComponents/KendoUI/kendo.blueopal.min.css" };
			base.specificJSCollection = null;
			base.dynamicJSCollection = new string[] { "/ScriptsG/inoHomeDynamic.js" };
			base.specificJqueryJSCollection = new string[] { "ClientComponents/KendoUI/kendo.web.min.js", "InnovacallJS/Home/Home.js" };
			base.externalCSS = null;
            base.jsVariables = null;
			base.Meta.Add(enMeta.Description, Resources.View_Home_Meta_Description);
			base.Meta.Add(enMeta.Keywords, Resources.View_Home_OrderWithDetails_Meta_Keywords);
			base.Meta.Add(enMeta.Subject, Resources.View_Home_OrderWithDetails_Meta_Subject);

			base.Initialize(requestContext);
		}

		[HttpGet, CacheManager(enCacheMode.NoCache)] //Manage your cache
		public ActionResult Index()
		{
			//NEVER USES VIEW BAG AGAIN !
			//ViewBag.Message = "Modify this template to kick-start your ASP.NET MVC application.";
			using (DataRepositories _dataContext = new DataRepositories())
			{
				base.InitView(
					Resources.View_Home_PageTitle,
					string.Empty,
					specificCssCollection,
					specificJSCollection,
					dynamicJSCollection,
					specificJqueryJSCollection,
                    jsVariables,
					externalCSS,
					Meta,
					_dataContext,
					true);
			}

			ContentData.InvolvedCode = new InvolvedCodeModel();
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.Html, TabStripName = "View", TabStripContent = "/Views/Home/Index.cshtml" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.Html, TabStripName = "Layout", TabStripContent = "/Views/Shared/_Layout.cshtml" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.cSharp, TabStripName = "Controller", TabStripContent = "/Controllers/HomeController.cs" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.cSharp, TabStripName = "Model", TabStripContent = "/Models/HomeModel.cs" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.Javascript, TabStripName = "View JS", TabStripContent = "/Scripts/InnovacallJS/Home/Home.js" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.Javascript, TabStripName = "Layout JS", TabStripContent = "/Scripts/InnovacallJS/_Layout/_Layout.js" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.Html, TabStripName = "Script G View", TabStripContent = "/Views/ScriptsG/inoHomeDynamic.cshtml" });
			ContentData.InvolvedCode.Add(new INNOVACALL.Framework.Common.Models.MetaModels.CodeFile_MetaModel() { Language = enCodeLanguage.GeneratedJavascript, TabStripName = "View Generated JS", TabStripContent = "/ScriptsG/inoHomeDynamic.js" });
			RenderCodeFiles(ContentData.InvolvedCode);

			return View(ContentData);
		}
	}
}
